<#assign className = table.className>   
<#assign classNameLower = className?uncap_first>
<% 
	var headContent = {
	include("/pages/template/head.html"){}
%>
<script type="text/javascript">
		
	var oper;
	jQuery(function($) {
		// 页面方法
		oper = {
			width : 400,
			height : 500,
			form : document.form1,
			list : function() {
				var url = 'admin/${namespace}/list';
				this.form.action = url;
				this.form.submit();
			},
			view : function(id) {
				var url = 'admin/${namespace}/view/'+id;
				var title = '查看${table.remarks}';
				Iframe(url, this.width, this.height, title, false, false, false, EmptyFunc);
			},
			add : function() {
				var url = 'admin/${namespace}/add';
				var title = '添加${table.remarks}';
				Iframe(url, this.width, this.height, title);
			},
			edit : function(id) {
				var url = 'admin/${namespace}/edit/'+id;
				var title = '修改${table.remarks}';
				Iframe(url, this.width, this.height, title);
			},
			del : function(id) {
				var url = 'admin/${namespace}/delete/'+id;
				var title = '确认要删除该${table.remarks}信息？';
				Confirm(title, function() {
					form1.action = url;
					form1.submit();
				});
			}
		};
		//显示Menu索引
		showMenu('page_${namespace}');
	});
	
	//分页
	var paginator = function(page) {
		oper.list();
	};
</script>
<%
};

var bodyContent = {
%>
	<form name="form1"  method="post"  class="form-inline" role="form">
		<input type="hidden" name="form.orderColumn" value="${r"${form.orderColumn!''}"}" />
		<input type="hidden" name="form.orderAsc" value="${r"${form.orderAsc!''}"}" />
		<!-- 菜单 -->

		<div class="tableSearch">
		<%  //查询列表 %>
			<#list table.columns as column>	
			<div class="form-group">
					<input class="form-control" type="text" name="attr.${column.sqlName}" value="${'$'}{attr.${column.sqlName}!''}" 
						placeholder="请输入${column.remarks}" required='required' />
			</div>
			</#list>
			<button type="button" class="btn btn-default" onclick="oper.list();" name="search">
			 		<span class="glyphicon glyphicon-search"></span> 查 询
			</button>
			<button type="button" class="btn btn-default" onclick="resetForm();">
			 		<span class="glyphicon glyphicon-refresh"></span> 重 置
			</button>
			<button type="button" class="btn btn-default" onclick="oper.add();">
			 		<span class="glyphicon glyphicon-plus"></span> 新 增
			</button>
		</div>
		
		<!-- 数据列表 -->
		<table class="table table-striped table-bordered table-hover">
			<thead>
				<tr>
					<th>序号</th>
					<%  // 列表头部 %>
					<#list table.columns as column>	
					<th name="${column.sqlName}" class="sorting">${column.remarks}</th> 
					</#list>
 					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			<% for(item in page.list){ %>
				<tr>
					<td>${r'${itemLP.index}'}</td>
					<%  // 列表内容 %>
					<#list table.columns as column>	
					<td title="${column.remarks}">${'$'}{item.${column.sqlName}}</td>
					</#list>
				<td>
				<a href="javascript:void(0);" class="btn btn-sm btn-success" onclick="oper.view(${r'${item.id}'});">查看</a> 
				<a href="javascript:void(0);" class="btn btn-sm btn-primary" onclick="oper.edit(${r'${item.id}'});">修改</a> 
				<a href="javascript:void(0);" class="btn btn-sm btn-danger" onclick="oper.del(${r'${item.id}'});">删除</a>
				</td>
				</tr>
			<% } %>
			</tbody>
		</table>
		<%include("/pages/includes/paginator.html"){} %>
	</form>
<%}; %>


<% layout("/pages/template/_layout.html",{head:headContent,body:bodyContent}){ %>
<%} %>

